package com.guigu.Curriculum.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guigu.Curriculum.entity.AbCourseSort;
import com.guigu.Curriculum.mapper.AbCourseSortMapper;
import com.guigu.Curriculum.service.AbCourseSortService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.sql.SQLOutput;
import java.util.List;

/**
 * <p>
 * 课程类别 前端控制器
 * </p>
 *
 * @author liulinjun
 * @since 2020-07-11
 */
@RestController
@RequestMapping("/abCourseSort")
public class AbCourseSortController {
    @Autowired
    private AbCourseSortService abCourseSortService;

    private QueryWrapper queryWrapper=new QueryWrapper();
    @Autowired
    private AbCourseSortMapper abCourseSortMapper;

    @RequestMapping(value = "adds")
    public boolean addabCourseSort(String sortTitle,int sortParentId){
        // System.out.println(sortTitle+"----"+sortParentId);
        return abCourseSortMapper.add(sortTitle,sortParentId);
    }
    @RequestMapping(value = "delete",method = RequestMethod.DELETE)
    public boolean deleteabCourseSort(int id){
        return abCourseSortService.removeById(id);
    }
    @RequestMapping(value = "update")
    public boolean updateabCourseSort(String sortTitle,int sortParentId,int sortId){

        return abCourseSortMapper.update(sortTitle,sortParentId,sortId);
    }
    @GetMapping("select")
    public List<AbCourseSort> selectAbCourseSort(){
        return abCourseSortMapper.ywyfind();
    }


}



